package hpu.e4_demo.controller;

import hpu.e4_demo.common.Result;
import hpu.e4_demo.entity.TRole;
import hpu.e4_demo.service.ITRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 角色类型表 前端控制器
 * </p>
 *
 * @author FFF
 * @since 2025-06-21
 */
@RestController
@RequestMapping("/tRole")
public class TRoleController {
    @Autowired
    private ITRoleService tRoleService;
    //找到所有的角色类型
    @RequestMapping("/getAllRole")
    Result<List<TRole>> getRole(Integer currentPage, Integer size)
    {
        return tRoleService.getRole(currentPage,size);
    }
    //新增角色类型
    @RequestMapping("/addRole")
    public Result<String> addRole(@RequestBody TRole tRole)
    {
        return tRoleService.addRole(tRole);
    }
    //修改角色类型
    @RequestMapping("/modifyRole")
    public Result<String> modifyRole(Integer id,String role){
        return tRoleService.modifyRole(id,role);
    }
    //删除角色类型
    @RequestMapping("/deleteRole")
    public Result<String> deleteRole(Integer id){
        return tRoleService.deleteRole(id);
    }



}
